package j.framework.qmd.jdbc;

import j.framework.core.LoginUser;
import j.framework.core.WebRequestConfiguration;
import j.framework.qmd.core.QueryFieldMetadata;
import j.framework.qmd.core.QueryMetadata;
import j.data.ActionResult;
import j.data.PagedData;

import java.util.List;

/**
 * User: jason
 * Date: 14-7-28 上午10:02
 */
public interface QueryMetadataService {
    /**
     * 获取查询定义
     * @param user
     * @param fid
     * @param page
     * @param rows
     * @return
     */
    PagedData<List<QueryMetadata>> getQueryList(LoginUser user, String fid, int page, int rows);

    /**
     * 获取一个查询的详细定义
     * @param queryId
     * @return
     */
    QueryMetadata getQueryMetadata(String queryId);

    QueryMetadata getFullQueryMetadata(String queryId);

    /**
     * 增加或保存查询
     * @param user
     * @param qmd
     * @param ar
     */
    void saveQueryMetadata(LoginUser user, QueryMetadata qmd, ActionResult ar);

    /**
     * 删除
     * @param user
     * @param queryId
     * @param ar
     */
    void deleteQueryMetadata(LoginUser user, String queryId, ActionResult ar);

    List<QueryFieldMetadata> getQueryFieldMetadataList(String queryId);

    /**
     * 批量保存
     * @param user
     * @param queryId
     * @param treeFieldId
     * @param treeParentFieldId
     * @param list
     * @param ar
     */
    void doSaveQueryFieldMetadata(LoginUser user, String queryId, String treeFieldId, String treeParentFieldId, List<QueryFieldMetadata> list, ActionResult ar);

    /**
     * 获取指定模块下的请求
     * @param functionId
     * @return
     */
    List<WebRequestConfiguration> getWebRequests(String functionId);

    /**
     * 增加或修改请求
     * @param user
     * @param wrc
     * @param ar
     */
    void saveWebRequestConfiguration(LoginUser user, WebRequestConfiguration wrc, ActionResult ar);

    /**
     * 删除请求
     * @param user
     * @param requestId
     * @param ar
     */
    void deleteWebRequestConfiguration(LoginUser user, String requestId, ActionResult ar);
}
